import * as actions from '../actions/index';

// 页面初始化数据
export const initialState = {
  mergeRequestData: null,
  loading: true,
};
const defaultAction = {
  type: 'doNothing',
};

export default function index(state = initialState, action = defaultAction) {
  switch (action.type) {
    case actions.UPDATE_DATA:
      return { ...state, ...action.data };
    case actions.RECEIVE_MERGE_DATA:
      return { ...state, mergeRequestData: action.data, loading: false };
    case actions.RESET_STATE:
      return initialState;
    default:
      return state;
  }
}
